﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using HtmlAgilityPack;

namespace NC.Cather.Helper
{
    public static class CheckHelper
    {
        /// <summary>
        /// 判断某Url是否有效
        /// </summary>
        /// <param name="url"></param>
        /// <returns></returns>
        public static string CheckUrlIsValid(string url)
        {
            HtmlWeb web = new HtmlWeb();
            web.OverrideEncoding = Encoding.Default;
            //下载目标Html页面代码
            string result = "";
            try
            {
                HtmlDocument homeDocument = web.Load(url);
            }
            catch (Exception e)
            {
                result = e.Message;
            }
            return result;
        }
    }
}
